<?php

/*
|--------------------------------------------------------------------------
| 后台路由
|--------------------------------------------------------------------------
*/

Route::get('login','Auth\LoginController@showLogin');
Route::post('login','Auth\LoginController@login')->name('login');
//Route::get('/login', 'Auth\LoginController@showLogin');

Route::namespace('Admin')->middleware('check')->group(function (){
    // 初始化系统
    Route::get('get_system_init', 'IndexController@getSystemInit');
    // 首页
    Route::get('/', 'IndexController@index');
    Route::get('index', 'IndexController@index');
    // 欢迎页
    Route::get('welcome', 'IndexController@welcome');

    // 菜单管理
        // 获取菜单数据
    Route::get('menu/list','MenuController@getMenu');
        // 修改状态
    Route::post('menu_change_status/{id}','MenuController@changeStatus');
    Route::resource('menu','MenuController');

    // 模型管理
    Route::get('model/list','ModelController@getModel');
    Route::resource('model','ModelController');

    // 字段管理
    Route::get('model-fields/list','ModelFieldController@getModelField');
    Route::resource('model-fields','ModelFieldController');

    // 产品管理
    Route::get('product/list','ProductController@getProductList');
    Route::resource('product','ProductController');

    // 新闻管理
    Route::get('news/list','NewsController@list');
    Route::resource('news','NewsController');

    // 分类管理
    Route::get('categories/list','CategoryController@list');
    Route::resource('categories','CategoryController');

    // 首页管理
    Route::get('banner_config/list','BannerController@list');
    Route::resource('banner_config','BannerController');

    // 网站管理
    Route::get('config/list','ConfigController@list');
    Route::resource('config','ConfigController');

    // 自定义内容管理
        // 列表页
    Route::get('content/{type}','ContentController@index');
        // 列表数据
    Route::get('content/{type}/list','ContentController@list');
        // 添加页
    Route::get('content/{type}/create','ContentController@create');
        // 执行添加
    Route::post('content/{type}','ContentController@store');
        // 修改
    Route::get('content/{type}/{id}/edit','ContentController@edit');
        // 执行修改
    Route::put('content/{type}/{id}','ContentController@update');
        // 删除
    Route::delete('content/{type}/{id}','ContentController@destroy');

    // 网站留言
    Route::get('message','MessageController@index');
    Route::get('message/list','MessageController@getList');
    Route::get('message/{id}/show','MessageController@show');

    // 上传图片
    Route::post('upload/img','UploadController@uploadImg')->name('image.upload');
    // 上传文件
    Route::post('upload/file','UploadController@uploadFile')->name('image.file');
    // 富文本编辑器上传图片
    Route::post('upload/edit','UploadController@editorUpload')->name('image.editor');
    // 修改状态
    Route::post('change_state/{url}/{field}','ChangeStateController@changeState');
});

